<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://unpkg.com/vue@next"></script>
</head>
<body>
    <!-- vue3写法,会有一点变化 -->
    <div class="box">
        {{1+1}}
        {{myname}}
       <ul>
        <li v-for="data in myList">{{data}}</li>
       </ul>
       <input type="text" v-model="myContent">
       {{myContent}}

       <button @click="addClass">add</button>
       <div :class="myClass">d变化</div>

    </div>

    <script>
        let obj = {
            data(){
                return{
                    myname:'huhu',
                    myList:['aa','bb'],
                    myContent:'',
                    myClass:{
                        aa:true,
                        bb:false,
                        cc:true
                    }
                }
            },
            methods:{
                addClass(){
                    // 动态添加class
                    this.myClass.ddd = true
                }
            }
        }
        // 绑定
        Vue.createApp(obj).mount('.box')
    </script>
    
</body>
</html>